<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>Insert title here</title>
</head>
<body>
<%
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
	Date d = new Date(session.getCreationTime());
	session.setAttribute("username", "LILI");
	session.setAttribute("age", 17);
	//设置当前session的最大生存期限
	session.setMaxInactiveInterval(5);//10秒钟后这个session作废，那么我们在10秒钟后点击连接进入testsession2.jsp，
	//此时这个session已经作废了，我们自然也就在testsession2.jsp中拿不到这个session的属性内容了。所以为null
%>
<a href="testsession/testsession2.jsp">click</a>
session创建的时间：<%=sdf.format(d)%></br>
session唯一的ID号：<%=session.getId() %></br>
session中age属性的值：<%=session.getAttribute("age") %></br>
seesion中的属性输出：
<% String[] str = session.getValueNames();
	for(String s : str) {
		out.println(s + ",");
	}
%>

</body>
</html>